//
//  ViewController.m
//  UITextViewPlaceDemo
//
//  Created by JianJian-Mac on 17/3/17.
//  Copyright © 2017年 Mecare. All rights reserved.
//

#import "ViewController.h"
#import "UITextView+WJPlaceholder.h"
#import "FirstViewController.h"

@interface ViewController ()

@end

@implementation ViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view, typically from a nib.
    
    self.view.backgroundColor = [UIColor blackColor];
    
    UITextView *textView = [[UITextView alloc] initWithFrame:CGRectMake(0, 100, [UIScreen mainScreen].bounds.size.width, 200)];
//    textView.backgroundColor = [UIColor blackColor];
    textView.placeholder = @"这是一个placeholder，利用runtime动态添加成员属性，swizz黑魔法交换dealloc方法进行observer的清理";
    textView.font = [UIFont systemFontOfSize:18];
    textView.placeholderColor = [UIColor redColor];
    textView.location = CGPointMake(20, 20);
    [self.view addSubview:textView];
    
    UIButton *nextBtn = [[UIButton alloc] initWithFrame:CGRectMake(0, CGRectGetMaxY(textView.frame)+ 50, 100, 100)];
    nextBtn.backgroundColor = [UIColor redColor];
    [nextBtn addTarget:self action:@selector(nextBtnClicked) forControlEvents:UIControlEventTouchUpInside];
    [self.view addSubview:nextBtn];
}

- (void)nextBtnClicked {

    FirstViewController *viewController = [[FirstViewController alloc] initWithNibName:@"FirstViewController" bundle:nil];
    [self presentViewController:viewController animated:NO completion:^{
    }];
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}


@end
